﻿using System;
using System.Collections.Generic;
using System.Linq;
using TuxedoLib;

namespace SpaceSquirrel
{
	public class ReadyScene : GameSceneBase
	{
		private Context context;
		private int counter;
		private PlayScene playScene;

		public ReadyScene(PlayScene previousScene, Context context)
			: base()
		{
			object[] startArgs = previousScene.startArgs;
			this.context = context;
			this.counter = 0;
			this.playScene = new PlayScene(
				(string)startArgs[0],
				(int)startArgs[1],
				(int)startArgs[2],
				context);
		}

		public override void ProcessInput(List<MyEvent> events, Dictionary<string, bool> pressedActions)
		{
			
		}

		public override void Update()
		{
			this.playScene.PlayMusic();
			this.counter++;
			if (this.counter > 90)
			{
				this.Next = this.playScene;
			}
		}

		public override void Render(TuxedoLib.Image screen, int renderCounter)
		{
			if (this.counter < 21)
			{
				screen.Fill(0, 0, 0);
			}
			else
			{
				this.playScene.Render(screen, 0);
				if ((renderCounter % 8) < 4)
				{
					Image img = Text.Render(-1, "ready");
					screen.Blit(img, 112, 112);
				}
			}
		}
	}
}
